<?php $q = $_GET['showuser']; ?>

<table height="320px" width="603px">
				<tr><td id="info" valign="top">
					<table cellpadding="0" cellspacing="0" >
						<tr><td width="395px" valign="top"><?php include 'navbar.php' ?></td>
						<td>&nbsp;</td>
						<td valign="top">
							<table cellpadding="0" cellspacing="0" border="0" align="right" width="185px"><tr><td>
							<?php 
							$username = $_SESSION['username'];          					$query = "select * from user where username='$username'";         					$result = mysql_query($query);
							if (!$result) {  							  echo '<script>							<!-- 								 window.location= "http://www.mariokartchallenger.com"							//-->							</script>'; die();							}
							$user = mysql_fetch_array($result);
							$temp = $user['nick'];
						    if (empty($temp)) { include 'guestgreet.php'; } else{ include 'usergreet.php'; } ?>
							</td></tr>
							<tr><td id="login">
								<div align="right"><span style="font-size:12px"><? echo $user['nick']; ?></span> ( <strong>
									<?php if (is_authed()) { echo '<a href="index.php?act=logout">Logout</a>';} 
										  else {echo '<a href="register.php">Register</a> | <a href="index.php">Log In</a> ';} ?> </strong> )</div>
						</td></tr></table>
					

						</td></tr>
					</table>

					<table cellpadding="0" cellspacing="0"><tr><td width="325px" height="245px" <?php           					$query = "select * from user where userid='$q'";         					$result = mysql_query($query);
							$racer = mysql_fetch_array($result);
							$salty = $racer['salt'];
							$userbattle = $racer['username'];
							if (empty($salty)) { echo '<script>							<!-- 								 window.location= "http://www.mariokartchallenger.com/index.php?act=news"							//-->							</script>'; }
							echo 'style="background: #ffffff url(profile/',$racer['racer'], '.jpg) no-repeat"' ?> valign="top">											<div align="right" id="profinfo">	
									<table cellpadding="0" cellspacing="0" border="0" align="right">
										<tr><td>
											<table cellpadding="0" cellspacing="0" border="0">
												<tr><td valign="bottom"><?php echo '<img src="img/' . $racer['country'] . '.gif" />'; ?></td>
													<td width="110px" valign="top" align="right" style="padding-right : 3px; padding-bottom : 1px">
														&nbsp;<?php echo '<h4><div align="right">' . $racer['nick'] . '</div></h4>'; ?>
													</td></tr>
													<tr><td></td><td align="right" style="padding-right : 3px">
														<span style="font-size:8pt">
														<?php echo'<img style="padding-top:2px" src="img/', $racer['skill'], '.png" />'; ?></span>													</td></tr>
											</table>
										</td></tr>
									</table>
	
									<br /><br /><br /><br /><br />

									<table cellpadding="0" cellspacing="0" align="right" width="250px">
										<tr><td>
											<? if (!is_authed() || $racer['userid'] == $user['userid']) { echo rating_bar( $racer['userid'],'5','static'); } else { echo rating_bar($racer['userid'],'5'); } ?>
										</td></tr>
										<tr><td align="right" style="padding-top:3px">
											<span style="font-size:10px; color:black; float :right"><strong>hosted races/battles:<br />
											<?php           									$query = "select * from gamematch where host='$userbattle' order by id desc LIMIT 5";         									$battle = mysql_query($query);
				
											while($gamematch = mysql_fetch_array($battle)){
										        echo '<a href="index.php?showroom=', $gamematch['id'], '">',$gamematch['battlename'],'</a>'; 												echo "<br />";											}
											?></strong></span></div>
										</td></tr>
									</table>

					</td><td valign="top">
                          <div align="right">
							<?php
                            if (is_authed()) { include 'sidebar.php';} elseif (!is_authed()) { echo '' ;} ?>						</div>
					</td>

					</tr></table>
				
					</td></tr>
			</table>
			</td>
		</tr>
	</table>

<?php include 'footer.php' ?>